<template>
  <div class="error-main">
    <div style="font-size: 35px; font-weight: bold">Network Error</div>
    <div v-if="onLine" style="font-size: 18px; margin-top: 10px">
      大事不妙啦！
    </div>
    <div style="font-size: 16px; margin-top: 10px">
      <div v-if="onLine">
        <div>连接服务器失败，请检查机器联网状态！</div>
        <div>如机器正常联网，请联系该网站管理员！</div>
      </div>
      <div v-else>机器未联网，请检查你的网络！</div>
    </div>
    <div style="font-size: 18px; margin-top: 10px">
      <a @click="refreshPage">刷新试试 ></a>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'errorpage',
    computed: {
      onLine() {
        console.log(navigator);
        return navigator.onLine;
      },
    },
    methods: {
      refreshPage() {
        window.location.href = window.location.origin;
      }
    }
  }
</script>

<style scoped>
  .error-main {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: #eff2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
  }
</style>